Micron Document
🎖️GitЯра🎖️

Commit ab07347e5af5fe680a7d1a32b3551ca6eb12255c


Parents : 40627fb
Author : James Rich <2199651+jamesarich@users.noreply.github.com>
Signature : Signature validation error
Date : 2026-06-25T05:34:53-05:00
Committer : GitHub <noreply@github.com>
Date : 2026-06-25T10:34:53Z

refactor: drop two over-engineered seams (enum + stdlib Base64) (#5945)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

Changes
Diff

diff --git a/core/common/src/commonMain/kotlin/org/meshtastic/core/common/util/Base64Factory.kt b/core/common/src/commonMain/kotlin/org/meshtastic/core/common/util/Base64Factory.kt
deleted file mode 100644
index a20a04ecd3..0000000000
--- a/core/common/src/commonMain/kotlin/org/meshtastic/core/common/util/Base64Factory.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2026 Meshtastic LLC
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-package org.meshtastic.core.common.util
-
-import kotlin.io.encoding.Base64
-import kotlin.io.encoding.ExperimentalEncodingApi
-
-/** Pure Kotlin Base64 utility — no expect/actual needed. */
-@OptIn(ExperimentalEncodingApi::class)
-object Base64Factory {
- fun encode(data: ByteArray): String = Base64.Default.encode(data)
-
- fun decode(data: String): ByteArray = Base64.Default.decode(data)
-}

diff --git a/core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/ScrollToTopEvent.kt b/core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/ScrollToTopEvent.kt
index 4548c23d09..6e35fb43e5 100644
--- a/core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/ScrollToTopEvent.kt
+++ b/core/ui/src/commonMain/kotlin/org/meshtastic/core/ui/component/ScrollToTopEvent.kt
@@ -24,10 +24,9 @@ import kotlinx.coroutines.flow.MutableSharedFlow
* Event emitted when a user re-presses a bottom navigation destination that should trigger a scroll-to-top behaviour on
* the corresponding screen.
*/
-sealed class ScrollToTopEvent {
- data object NodesTabPressed : ScrollToTopEvent()
-
- data object ConversationsTabPressed : ScrollToTopEvent()
+enum class ScrollToTopEvent {
+ NodesTabPressed,
+ ConversationsTabPressed,
}
@Composable fun rememberScrollToTopEvents(): MutableSharedFlow<ScrollToTopEvent> = remember { MutableSharedFlow() }

diff --git a/feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/ui/contact/Contacts.kt b/feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/ui/contact/Contacts.kt
index 3a3e75a232..8d49c7051b 100644
--- a/feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/ui/contact/Contacts.kt
+++ b/feature/messaging/src/commonMain/kotlin/org/meshtastic/feature/messaging/ui/contact/Contacts.kt
@@ -173,7 +173,7 @@ fun ContactsScreen(
LaunchedEffect(scrollToTopEvents) {
scrollToTopEvents?.collectLatest { event ->
- if (event is ScrollToTopEvent.ConversationsTabPressed) {
+ if (event == ScrollToTopEvent.ConversationsTabPressed) {
contactsListState.smartScrollToTop(coroutineScope)
}
}

diff --git a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/NodeDetailsSection.kt b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/NodeDetailsSection.kt
index 7641103fc2..11df01a8c3 100644
--- a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/NodeDetailsSection.kt
+++ b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/component/NodeDetailsSection.kt
@@ -49,7 +49,6 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.stringResource
-import org.meshtastic.core.common.util.Base64Factory
import org.meshtastic.core.common.util.MetricFormatter
import org.meshtastic.core.model.DeviceHardware
import org.meshtastic.core.model.Node
@@ -92,6 +91,8 @@ import org.meshtastic.core.ui.icon.Verified
import org.meshtastic.core.ui.icon.role
import org.meshtastic.core.ui.util.createClipEntry
import org.meshtastic.core.ui.util.formatAgo
+import kotlin.io.encoding.Base64
+import kotlin.io.encoding.ExperimentalEncodingApi
@Composable
fun NodeDetailsSection(
@@ -324,7 +325,7 @@ private fun MqttAndVerificationRow(node: Node) {
}
}
-@OptIn(ExperimentalFoundationApi::class)
+@OptIn(ExperimentalFoundationApi::class, ExperimentalEncodingApi::class)
@Suppress("LongMethod", "MagicNumber")
@Composable
private fun PublicKeyItem(publicKeyBytes: ByteArray) {
@@ -335,7 +336,7 @@ private fun PublicKeyItem(publicKeyBytes: ByteArray) {
if (isMismatch) {
stringResource(Res.string.error)
} else {
- Base64Factory.encode(publicKeyBytes).trim()
+ Base64.Default.encode(publicKeyBytes).trim()
}
val label = stringResource(Res.string.public_key)
val copyLabel = stringResource(Res.string.copy)

diff --git a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/list/NodeListScreen.kt b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/list/NodeListScreen.kt
index e991ee36c9..7e20fe4756 100644
--- a/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/list/NodeListScreen.kt
+++ b/feature/node/src/commonMain/kotlin/org/meshtastic/feature/node/list/NodeListScreen.kt
@@ -114,7 +114,7 @@ fun NodeListScreen(
LaunchedEffect(scrollToTopEvents) {
scrollToTopEvents?.collectLatest { event ->
- if (event is ScrollToTopEvent.NodesTabPressed) {
+ if (event == ScrollToTopEvent.NodesTabPressed) {
listState.smartScrollToTop(coroutineScope)
}
}

Served by rngit 1.5.4 - Generated in 0.08s